<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    :footer="null"
    @cancel="visible=false">
    <a-card :bordered="false">

      <div class="table-operator">
        <a-button @click="addRemark" type="primary" icon="plus">新增</a-button>
      </div>

      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :loading="loading"
          class="j-table-force-nowrap">
        <span slot="action" slot-scope="text, record">
           <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
               <a>删除</a>
           </a-popconfirm>
        </span>
        </a-table>
      </div>
      <vca-remark-modal ref="modalForm" @ok="modalFormOk" :type="type"></vca-remark-modal>
    </a-card>

  </j-modal>

</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import VcaRemarkModal from './modules/VcaRemarkModal'

export default {
  name: 'VcaRemarkList',
  mixins:[JeecgListMixin, mixinDevice],
  components: {
    VcaRemarkModal
  },
  props:["type"],
  data () {
    return {
      visible:false,
      disableMixinCreated:true,
      width:800,
      title:'',
      model:{},
      columns: [
        {
          title:'备注',
          align:"center",
          dataIndex: 'remark'
        },
        {
          title:'添加时间',
          align:"center",
          dataIndex: 'createTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align:"center",
          fixed:"right",
          width:147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/villageCadreAssist/vcaRemark/list",
        delete: "/villageCadreAssist/vcaRemark/delete",
        deleteBatch: "/villageCadreAssist/vcaRemark/deleteBatch",
        exportXlsUrl: "/villageCadreAssist/vcaRemark/exportXls",
        importExcelUrl: "villageCadreAssist/vcaRemark/importExcel",
      },
      dictOptions:{},
      superFieldList:[],
    }
  },

  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  mounted() {
  },
  methods: {
    addRemark(){
      this.$refs.modalForm.add(this.model);
      this.$refs.modalForm.title = "新增";
      this.$refs.modalForm.disableSubmit = false;
    },
    view(record){
      this.model = Object.assign({},record)
      this.queryParam.businessId = record["id"];
      this.loadData();
      this.visible=true;
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
